package UserUI;

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;

import vo.StudentVO;

public class StudentInfo extends JPanel {
	protected JLabel namelbl;
	protected JLabel numlbl;
	protected JLabel deplbl;
	protected JLabel commonlbl;
	protected JLabel professionlbl;
	protected JLabel requirelbl;
	protected JLabel totallbl;
	protected JLabel enterlbl;

	protected JTextField nameText;
	protected JTextField numText;
	protected JTextField depText;
	protected JTextField commonText;
	protected JTextField professionText;
	protected JTextField requireText;
	protected JTextField totalText;
	protected JTextField enterText;

	/**
	 * Create the panel.
	 */
	public StudentInfo(StudentVO aim) {
		this.setSize(768, 580);
		this.setVisible(true);
		this.setLayout(null);
		setOpaque(false);
		namelbl = new JLabel("\u59D3\u540D");
		namelbl.setBounds(0, 34, 72, 18);
		add(namelbl);

		nameText = new JTextField(aim.studentName);
		nameText.setBounds(0, 52, 109, 24);
		add(nameText);
		nameText.setColumns(10);
		nameText.setEditable(false);

		numlbl = new JLabel("\u5B66\u53F7");
		numlbl.setBounds(180, 34, 72, 18);
		add(numlbl);

		numText = new JTextField(aim.ID);
		numText.setBounds(180, 52, 109, 24);
		add(numText);
		numText.setColumns(10);
		numText.setEditable(false);

		deplbl = new JLabel("\u9662\u7CFB");
		deplbl.setBounds(0, 95, 92, 18);
		add(deplbl);

		depText = new JTextField(aim.department);
		depText.setBounds(0, 113, 109, 24);
		add(depText);
		depText.setColumns(10);
		depText.setEditable(false);

		commonlbl = new JLabel("\u516C\u5171\u8BFE\u5B66\u5206");
		commonlbl.setBounds(180, 95, 92, 18);
		add(commonlbl);

		commonText = new JTextField(aim.common);
		commonText.setBounds(180, 113, 109, 24);
		add(commonText);
		commonText.setColumns(10);
		commonText.setEditable(false);

		professionlbl = new JLabel("\u4E13\u4E1A\u8BFE\u5B66\u5206");
		professionlbl.setBounds(0, 169, 92, 18);
		add(professionlbl);

		professionText = new JTextField(aim.profession);
		professionText.setBounds(0, 184, 109, 24);
		add(professionText);
		professionText.setColumns(10);
		professionText.setEditable(false);

		requirelbl = new JLabel("\u5FC5\u4FEE\u8BFE\u5B66\u5206");
		requirelbl.setBounds(180, 169, 92, 18);
		add(requirelbl);

		requireText = new JTextField(aim.require);
		requireText.setBounds(180, 184, 109, 24);
		add(requireText);
		requireText.setColumns(10);
		requireText.setEditable(false);

		totallbl = new JLabel("\u603B\u5B66\u5206");
		totallbl.setBounds(0, 245, 72, 18);
		add(totallbl);

		totalText = new JTextField(aim.total);
		totalText.setBounds(0, 262, 109, 24);
		add(totalText);
		totalText.setColumns(10);
		totalText.setEditable(false);

		enterlbl = new JLabel("\u5165\u5B66\u5E74\u4EFD");
		enterlbl.setBounds(180, 245, 72, 18);
		add(enterlbl);

		enterText = new JTextField(aim.enterYear);
		enterText.setBounds(180, 262, 109, 24);
		add(enterText);
		enterText.setColumns(10);
		enterText.setEditable(false);
		this.setOpaque(false);
	}

	public void showStudent(StudentVO aim) {
		nameText.setText(aim.studentName);
		numText.setText(aim.ID);
		depText.setText(aim.department);
		commonText.setText(aim.common);
		professionText.setText(aim.profession);
		requireText.setText(aim.require);
		totalText.setText(aim.total);
		enterText.setText(aim.enterYear);
		this.repaint();
	}
}
